import request from "@/utils/request";

export const searchUserByUsername = (username) => {
  return request.get(`/user/userInfo/${username}`);
};

export const addFriend = (userId, friendId) => {
  return request.post("/friend/add", null, { params: { userId, friendId } });
};

export const acceptFriendRequest = (userId, friendId) => {
  return request.post("/friend/accept", null, { params: { userId, friendId } });
};

export const rejectFriendRequest = (userId, friendId) => {
  return request.post("/friend/reject", null, { params: { userId, friendId } });
};

export const getFriendList = (userId) => {
  return request.get("/friend/list", { params: { userId } });
};

export const deleteFriend = (userId, friendId) => {
  return request.delete("/friend/delete", { params: { userId, friendId } });
};

// 获取未处理的好友请求通知
export const getNotifications = (userId) => {
  return request.get('/friend/notifications', {
    params: {
      userId
    }
  });
};

